<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            height: 100px;
            background-color: #fc3;
        }
        #inner{
            width: 100px;
            height: 100px;
            background-color: #f00;
            position: absolute;
            top:300px;
        }
    </style>
</head>
<body>

    <div id="box">
        <div id="inner"></div>
    </div>

    <script>
        // 事件冒泡
        // 事件 从子集元素 “穿透” 到 父级上
        let oBox = document.getElementById('box');
        let oInner = document.getElementById('inner');
        oInner.onclick = function(){
            console.log('inner msg');
        }

        oBox.onclick = function(){
            console.log('box msg');
        }
    </script>
</body>
</html>